files = [
	'design/action-top.jpg',
	'design/block-icon.png',
	'design/block-icon-hover.png',
	'design/block-top.jpg',
	'design/box.png',
	'design/collapsed.png',
	'design/condition-left.png',
	'design/condition-right.png',
	'design/condition-negated-left.png',
	'design/condition-negated-right.png',
	'design/delete-scene.png',
	'design/edit-scene.png',
	'design/else.png',
	'design/gradient.png',
	'design/loading.gif',
	'design/logo.jpg',
	'design/new-scene.png',
	'design/object-game.png',
	'design/object-scene.png',
	'design/object-selected.png',
	'design/object-selected-game.png',
	'design/object-selected-scene.png',
	'design/outline.png',
	'design/save.png',
	'design/tab-border.png',
	'design/tab-left.png',
	'design/tab-right.png',
	'index.html',
	'play.html',
	'server/config.php',
	'server/JSON.php',
	'server/server.php',
	'server/demjson.py',
	'server/main.py',
	'server/app.yaml',
	'server/index.yaml'
]

scripts = [
	'client/mootools-beta-1.2b2.js',
	'client/Tack.js',
	'client/Tack.Menu.js',
	'client/Tack.Action.js',
	'client/Tack.Action.EndGame.js',
	'client/Tack.Action.SetState.js',
	'client/Tack.Action.ShowText.js',
	'client/Tack.Action.ChangeScene.js',
	'client/Tack.ActionBlock.js',
	'client/Tack.Condition.js',
	'client/Tack.Condition.EventArgument.js',
	'client/Tack.Condition.PreviousScene.js',
	'client/Tack.Condition.StateOn.js',
	'client/Tack.Console.js',
	'client/Tack.Designer.js',
	'client/Tack.Designer.ActionBlock.js',
	'client/Tack.Designer.Action.js',
	'client/Tack.Designer.Condition.js',
	'client/Tack.Game.js',
	'client/Tack.Pane.js',
	'client/Tack.Pane.Debug.js',
	'client/Tack.Pane.Explorer.js',
	'client/Tack.Pane.Properties.js',
	'client/Tack.Player.js',
	'client/Tack.Scene.js',
	'client/Tack.Sidebar.js',
	'client/index.js'
]

styles = [
	'design/global.css',
	'design/Tack.css',
	'design/Tack.Console.css',
	'design/Tack.Designer.css',
	'design/Tack.Menu.css',
	'design/Tack.Pane.css',
	'design/Tack.Sidebar.css'
]

import os, shutil

if os.path.exists('release'): shutil.rmtree('release', True)
os.mkdir('release')

for f in files:
	shutil.copyfile(f, 'release/' + os.path.basename(f))

packed = open('release/index.unminified.js', 'w')
for script in scripts:
	fh = open(script)
	packed.write('/* ' + script + ' */\n' + fh.read() + '\n\n')
	fh.close()
packed.close()

os.system('java -jar yuicompressor-2.3.1.jar -o release/index.js release/index.unminified.js')

packed = open('release/index.unminified.css', 'w')
for style in styles:
	fh = open(style)
	packed.write('/* ' + style + ' */\n' + fh.read() + '\n\n')
	fh.close()
packed.close()

os.system('java -jar yuicompressor-2.3.1.jar -o release/index.css release/index.unminified.css')

scripts = [
	'client/mootools-beta-1.2b2.js',
	'client/Tack.js',
	'client/Tack.Action.js',
	'client/Tack.Action.EndGame.js',
	'client/Tack.Action.SetState.js',
	'client/Tack.Action.ShowText.js',
	'client/Tack.Action.ChangeScene.js',
	'client/Tack.ActionBlock.js',
	'client/Tack.Condition.js',
	'client/Tack.Condition.EventArgument.js',
	'client/Tack.Condition.PreviousScene.js',
	'client/Tack.Condition.StateOn.js',
	'client/Tack.Console.js',
	'client/Tack.Game.js',
	'client/Tack.Player.js',
	'client/Tack.Scene.js',
	'client/play.js'
]

styles = [
	'design/global.css',
	'design/play.css',
	'design/Tack.Console.css'
]

packed = open('release/play.unminified.js', 'w')
for script in scripts:
	fh = open(script)
	packed.write('/* ' + script + ' */\n' + fh.read() + '\n\n')
	fh.close()
packed.close()

os.system('java -jar yuicompressor-2.3.1.jar -o release/play.js release/play.unminified.js')

packed = open('release/play.unminified.css', 'w')
for style in styles:
	fh = open(style)
	packed.write('/* ' + style + ' */\n' + fh.read() + '\n\n')
	fh.close()
packed.close()

os.system('java -jar yuicompressor-2.3.1.jar -o release/play.css release/play.unminified.css')
